<script setup>
import { ref, onMounted } from 'vue';
import { uniFetch } from '../../api/uni-fetch';

function goSaveAgain() {
	uni.redirectTo({
		url: '/subpkg_save/SaveIndex/SaveIndex'
	});
}

const props = defineProps(['id','devicecode']);

async function againOpen(){
	const res =await uniFetch.post('/user/pick-repeat',{box_id:props.devicecode, lane_command :props.id})
	console.log(res);
	if(res.code === 10000){
			 uni.showToast({
			 	icon:'none',
				title:'已重新开门'
			 })
	}
}
</script>

<template>
	<view class="body">
		<view class="open-which">
			<view class="open">
				<view class="which-tile">
					<view>{{ props.id }}号柜门已开</view>
					<view class="tips">取件后请及时关门哦</view>
				</view>
				<image src="/static/images/opendoor.png" mode="widthFix"></image>
				<view class="button">
					<navigator open-type="reLaunch" url="/pages/index/index" class="button-item">返回首页</navigator>
					<navigator open-type="navigateBack" class="button-item" style="background-color: #daf8f1;">继续取件</navigator>
				</view>
					<view class="button">
				<view @click="againOpen" class="button-item"  style="width: 100%;margin: 40rpx 0;background-color: #e1faf4;" >重新开门</view>
				</view>
			</view>
		</view>
	</view>
</template>

<style lang="scss">
@import '/uni.scss';

.open-which {
	box-sizing: border-box;
	padding: 50rpx;
	height: 100vh;
	background: linear-gradient(to bottom, #3ae1c1, #fff);
	color: #fefefe;

	.open {
		padding: 40rpx 0 20rpx;
		background-color: #fff;
		border-radius: 25rpx;

		.which-tile {
			font-size: 60rpx;
			height: 120rpx;
			color: #000;
			text-align: center;
			.tips {
				font-size: 28rpx;
				line-height: 40rpx;
			}
		}
		image {
			display: block;
			margin: 30rpx auto 40rpx;
			width: 400rpx;
		}

		.button {
			display: flex;
			justify-content: space-between;
			width: 90%;
			margin: 0 auto;
			.button-item {
				width: 280rpx;
				height: 86rpx;
				border-radius: 43rpx;
				border: 2rpx solid #e6e6e6;
				line-height: 86rpx;
				text-align: center;
				color: #000;
				font-size: 33rpx;
			}
		}
	}
}
</style>
